package org.example.springbootdeptemp.mapper;

import org.apache.ibatis.annotations.*;
import org.example.springbootdeptemp.pojo.Dept;

import java.util.List;

@Mapper
public interface DeptMapper {

    @Update("update dept set name=#{name},update_time=NOW() where id=#{id}")
    int updateDepts(Dept dept);

    @Delete("delete from dept where id=#{id}")
    int deleteDepts(Integer id);

    @Select("select * from dept where id=#{id}")
    Dept selectById(Integer id);

    @Insert("insert into dept (name, create_time, update_time) " +
            "VALUES (#{name},NOW(),NOW())")
    int insert(Dept dept);

    @Select("select * from dept")
    List<Dept> selectAll();

}
